package main

import (
	"context"
	"fmt"
	"net"
	"os"
	"os/signal"
)

func main() {

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	ls, err := net.Listen("tcp", "127.0.0.1:5555")
	if err != nil {
		panic(err)
	}

	ioLoop := NewTcpPackServer(context.Background(), ls)

	for i := 0; i < 1; i++ {
		ioLoop.Launch()
	}
	ioLoop.Run()

	select {
	case <-c:
		ioLoop.StopAndWait()
	}
	fmt.Println("is over!")
}
